home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / bb212src / bbsetupb.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1992-02-16  |  4.0 KB  |  156 lines

  1. (*===========================================================================*)
  2. (* Build beacon path information for certain ports                           *)
  3. (*                                                                           *)
  4. (*   Copyright 1991 by H. Roy Engehausen.  All rights reserved.              *)
  5. (*                                                                           *)
  6. (*===========================================================================*)
  7.  
  8. (*===========================================================================*)
  9. (* Build beacon ports                                                        *)
  10. (*===========================================================================*)
  11.  
  12. PROCEDURE build_beacon_ports;
  13.  
  14.   {$I AX25.PAS}
  15.  
  16.   VAR
  17.     this_port : port_block_ptr;
  18.  
  19.   (*=========================================================================*)
  20.   (* This routine is change a call sign to AX25 format                       *)
  21.   (*=========================================================================*)
  22.  
  23.   PROCEDURE call_change_to_packet(VAR out_call : address_field;
  24.                                       in_call  : STRING);
  25.  
  26.     VAR
  27.       char_temp   : CHAR;
  28.       i           : INTEGER;
  29.       j           : INTEGER;
  30.       out_temp    : address_field;
  31.       ssid_temp   : BYTE;
  32.       ssid_switch : BOOLEAN;
  33.  
  34.     LABEL iterate;
  35.  
  36.     BEGIN;
  37.  
  38.       (*-------------------------------------------------------------------*)
  39.       (* Blank it out to start with                                        *)
  40.       (*-------------------------------------------------------------------*)
  41.  
  42.       out_temp.name[1] := CHR(0);
  43.  
  44.       FOR i := 2 TO 6 DO
  45.           out_temp.name[i] := CHR(ORD(' ') * 2);
  46.  
  47.       out_temp.addr_flag := flag_reser;
  48.  
  49.       out_call := out_temp;
  50.  
  51.       j := LENGTH(in_call);
  52.  
  53.       IF (j = 0) OR (in_call[1] = ' ') THEN
  54.         EXIT;
  55.  
  56.       WHILE (j > 1) AND (in_call[j] = ' ') DO
  57.         j := j - 1;
  58.  
  59.       i           := 0;
  60.       ssid_switch := FALSE;
  61.       ssid_temp   := 0;
  62.  
  63.       WHILE i < j DO
  64.         BEGIN;
  65.  
  66.           i := i + 1;
  67.  
  68.           char_temp := UPCASE(in_call[i]);
  69.  
  70.           IF char_temp = '-' THEN
  71.             BEGIN;
  72.               IF ssid_switch THEN
  73.                 EXIT;
  74.  
  75.               ssid_switch := TRUE;
  76.               GOTO ITERATE;
  77.             END;
  78.  
  79.           IF ssid_switch THEN
  80.             BEGIN;
  81.               IF (char_temp < '0') OR (char_temp > '9') THEN
  82.                 EXIT;
  83.               ssid_temp := 10 * ssid_temp + (ORD(char_temp) - ORD('0'));
  84.               GOTO ITERATE;
  85.             END;
  86.  
  87.           IF i <= 6 THEN
  88.             out_temp.name[i] := CHR(ORD(char_temp) * 2)
  89.           ELSE
  90.             EXIT;
  91.  
  92. iterate:
  93.  
  94.         END;
  95.  
  96.       IF ssid_temp > ssid_max THEN
  97.         EXIT;
  98.  
  99.       out_temp.addr_flag := ((ssid_temp SHL flag_ssid_shift) AND flag_ssid);
  100.  
  101.       out_call := out_temp;
  102.  
  103.     END;
  104.  
  105.   (*=========================================================================*)
  106.   (* Build the BPQ path                                                      *)
  107.   (*=========================================================================*)
  108.  
  109.   PROCEDURE build_bpq_path;
  110.  
  111.     VAR
  112.       info : address_area;
  113.       buff : ARRAY[1..256] OF BYTE;
  114.  
  115.       i    : BYTE;
  116.       p    : STRING;
  117.       w    : STRING[10];
  118.  
  119.     BEGIN;
  120.  
  121.       p := this_port^.bcst_path;
  122.  
  123.       w := subword(@p, 1, 1);
  124.  
  125.       call_change_to_packet(info.dest, w);
  126.  
  127.       call_change_to_packet(info.source, opt_block.this_bb_addr);
  128.  
  129.       i := 2 * SIZEOF(address_field);
  130.  
  131.       MOVE(info, buff[1], i);
  132.  
  133.       buff[i]   := control_uf;
  134.       buff[i+1] := protocol_no3;
  135.  
  136.     END;
  137.  
  138.   BEGIN;
  139.  
  140.     this_port :=  port_chain;
  141.     WHILE this_port <> NIL DO
  142.       BEGIN;
  143.  
  144.         CASE this_port^.port_type OF
  145.           port_bpqhost:
  146.             IF this_port^.bcst_path <> '' THEN
  147.               build_bpq_path;
  148.           ELSE
  149.             ;
  150.         END;
  151.  
  152.         this_port := this_port^.next_port;
  153.       END;
  154.  
  155.   END;
  156.